package model_layer;

import java.util.List;

/**
 * The Class StaffMember.
 */
public class StaffMember
{
	
	private int id;
	private String phone_nr;
	private String email;
	private int privilage_level;
	private String fname;
	private String lname;
	private String login;
	private String password;
	private List<Sale> made_sales;
	private boolean deleted;
	
	/**
	 * Instantiates a new staff member.
	 */
	public StaffMember()
	{
	}
	
	/**
	 * Instantiates a new staff member.
	 *
	 * @param id the id
	 * @param phone_nr the phone number
	 * @param email the email
	 * @param privilages the privilages
	 * @param fname the first name
	 * @param lname the last name
	 * @param made_sales the made_sales
	 */
	public StaffMember(int id, String phone_nr, String email, int privilages, String fname, String lname,
			List<Sale> made_sales)
	{
		this.id = id;
		this.phone_nr = phone_nr;
		this.email = email;
		this.privilage_level = privilages;
		this.fname = fname;
		this.lname = lname;
		this.made_sales = made_sales;
	}

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public int getId()
	{
		return id;
	}

	/**
	 * Gets the phone number.
	 *
	 * @return the phone_nr
	 */
	public String getPhone_nr()
	{
		return phone_nr;
	}

	/**
	 * Gets the email.
	 *
	 * @return the email
	 */
	public String getEmail()
	{
		return email;
	}

	/**
	 * Gets the privilege level.
	 *
	 * @return the privilege level
	 */
	public int getPrivilage_level()
	{
		return privilage_level;
	}

	/**
	 * Gets the first name.
	 *
	 * @return the first name.
	 */
	public String getFname()
	{
		return fname;
	}

	/**
	 * Gets the last name.
	 *
	 * @return the last name
	 */
	public String getLname()
	{
		return lname;
	}

	/**
	 * Gets all the made sales by a Staff member.
	 *
	 * @return the made sales
	 */
	public List<Sale> getMade_sales()
	{
		return made_sales;
	}

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(int id)
	{
		this.id = id;
	}

	/**
	 * Sets the phone number.
	 *
	 * @param phone_nr the new phone_nr
	 */
	public void setPhone_nr(String phone_nr)
	{
		this.phone_nr = phone_nr;
	}

	/**
	 * Sets the email.
	 *
	 * @param email the new email
	 */
	public void setEmail(String email)
	{
		this.email = email;
	}

	/**
	 * Sets the privilege level.
	 *
	 * @param privilages the new privilege level
	 */
	public void setPrivilage_level(int privilages)
	{
		this.privilage_level = privilages;
	}

	/**
	 * Sets the first name.
	 *
	 * @param fname the new first name.
	 */
	public void setFname(String fname)
	{
		this.fname = fname;
	}

	/**
	 * Sets the last name.
	 *
	 * @param lname the new last name
	 */
	public void setLname(String lname)
	{
		this.lname = lname;
	}

	/**
	 * Adds a new sale to a staff member.
	 *
	 * @param sale the sale
	 */
	public void add_sale(Sale sale)
	{
		made_sales.add(sale);
	}

	/**
	 * Gets the username.
	 *
	 * @return the username
	 */
	public String getLogin()
	{
		return login;
	}

	/**
	 * Gets the password.
	 *
	 * @return the password
	 */
	public String getPassword()
	{
		return password;
	}

	/**
	 * Sets the username.
	 *
	 * @param login the new username
	 */
	public void setLogin(String login)
	{
		this.login = login;
	}

	/**
	 * Sets the password.
	 *
	 * @param password the new password
	 */
	public void setPassword(String password)
	{
		this.password = password;
	}

	/**
	 * Sets the made sales by a staff member.
	 *
	 * @param made_sales the new made sales
	 */
	public void setMade_sales(List<Sale> made_sales)
	{
		this.made_sales = made_sales;
	}

	/**
	 * Checks if a staff member is being marked as deleted.
	 *
	 * @return true, if is deleted
	 */
	public boolean isDeleted()
	{
		return deleted;
	}

	/**
	 * Sets staff member as deleted.
	 *
	 * @param deleted the new deleted
	 */
	public void setDeleted(boolean deleted)
	{
		this.deleted = deleted;
	}
	
	/**
	 * Gets a sale made by a staff member.
	 *
	 * @param id the id of a sale
	 * @return the sale
	 */
	public Sale get_sale(int id)
	{
		for (Sale sale : made_sales)
		{
			if(sale.getId() == id)
			{
				return sale;
			}
		}
		return null;
	}
	
	/**
	 * Gets the total price of all sales of a staff member.
	 *
	 * @return the _total_price_of_sales
	 */
	public float get_total_price_of_sales()
	{
		float total_price = 0;
		for(Sale sale : made_sales)
		{
			total_price += sale.getTotal_price();
		}
		return total_price;
	}
	
	
	
	
	
	
	
}
